package mr.ali.video.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import mr.ali.video.web.Exception.ServiceException;
import mr.ali.video.web.model.CollectionAlpay;
import mr.ali.video.web.mapper.CollectionAlpayMapper;
import mr.ali.video.web.service.ICollectionAlpayService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr-ali
 * @since 2025-08-03
 */
@Service
public class CollectionAlpayServiceImpl extends ServiceImpl<CollectionAlpayMapper, CollectionAlpay> implements ICollectionAlpayService {
@Resource
private CollectionAlpayMapper colelctionAlpayMapper;

    @Override
    public List<CollectionAlpay> getAlpay() {
        QueryWrapper<CollectionAlpay> queryWrapper = new QueryWrapper<>();
        return  colelctionAlpayMapper.selectList(queryWrapper);
    }
    @Override
    public Integer updateDisplayed(Integer id, Integer displayed) {

        Integer i = colelctionAlpayMapper.updateAlpay(id, displayed);
        if (i == 0) {
            throw new ServiceException("更新失败");
        }
        return i;
    }
    @Override
    public Integer updateAlpayName(CollectionAlpay alpay) {
        Integer i = colelctionAlpayMapper.updateAlpayName(alpay);
        if (i == 0) {
            throw new ServiceException("更新失败");
        }
        return i;
    }

}
